﻿<UserControl x:Class="SIEGate.UI.UserControls.SubscriberUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" d:DesignHeight="650" d:DesignWidth="850"
             xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:uc="clr-namespace:GSF.TimeSeries.UI.UserControls;assembly=GSF.TimeSeries.UI.WPF"
             xmlns:tsfBinding="clr-namespace:GSF.TimeSeries.UI.Binding;assembly=GSF.TimeSeries.UI"
             Background="Transparent">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/GSF.TimeSeries.UI.WPF;Component/Resources/CommonResource.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <StackPanel Orientation="Vertical">
        <Grid x:Name="GridDetailView" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="5" DataContext="{Binding Path=CurrentItem, Mode=TwoWay}" DataContextChanged="GridDetailView_DataContextChanged">
            <Grid.BindingGroup>
                <BindingGroup Name="input"/>
            </Grid.BindingGroup>
            
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <!--First Row-->
            <Button Grid.Row="0" Grid.Column="0" Content="Import SRQ..." Click="Button_Click" Name="ButtonClick" />

            <!--Second Row-->
            <TextBlock Grid.Row="1" Grid.Column="0" Text="Acronym" />
            <TextBox Grid.Row="1" Grid.Column="1" Text="{tsfBinding:Column Path=Acronym}" Name="AcronymField" CharacterCasing="Upper" />
            <TextBlock Grid.Row="1" Grid.Column="2" Text="Name" />
            <TextBox Grid.Row="1" Grid.Column="3" Text="{tsfBinding:Column Path=Name}" Name="NameField" />

            <!--Third Row-->
            <TextBlock Grid.Row="2" Grid.Column="0" Text="Remote Certificate" />
            <TextBox Grid.Row="2" Grid.Column="1" Text="{tsfBinding:Column Path=RemoteCertificateFile}" Name="RemoteCertificateField" />
            <CheckBox Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" Content="Self-signed?" Name="SelfSignedCheckbox" />

            <!--Fourth Row-->
            <StackPanel Grid.Row="3" Grid.Column="2" Grid.ColumnSpan="2" Margin="0,0,0,10" Orientation="Horizontal" VerticalAlignment="Center">
                <RadioButton Margin="5,0" Name="InternalRadioButton" GroupName="Interface" Content="Internal" Checked="InterfaceRadioButton_Checked" />
                <RadioButton Margin="5,0" Name="ExternalRadioButton" GroupName="Interface" Content="External" IsChecked="True" Checked="InterfaceRadioButton_Checked" />
            </StackPanel>

            <!--Fifth Row-->
            <TextBlock Grid.Row="4" Grid.Column="0" Text="Valid IP Addresses" />
            <TextBox Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Width="480" Text="{tsfBinding:Column Path=ValidIPAddresses}" Name="ValidIpAddressesField" />

            <!--Sixth Row-->
            <TextBlock Grid.Row="5" Grid.Column="0" Text="Valid Policy Errors" />
            <TextBox Grid.Row="5" Grid.Column="1" Text="{tsfBinding:Column Path=ValidPolicyErrors}" Name="ValidPolicyErrorsField" />
            <TextBlock Grid.Row="5" Grid.Column="2" Text="Valid Chain Flags" />
            <TextBox Grid.Row="5" Grid.Column="3" Text="{tsfBinding:Column Path=ValidChainFlags}" Name="ValidChainFlagsField" />
            
            <!--Seventh Row-->
            <CheckBox Grid.Row="6" Grid.Column="3" Content="Enable Connection" IsChecked="{tsfBinding:Column Path=Enabled}" Name="EnablePGConnection" />
        </Grid>

        <uc:DetailViewFooterUserControl DeleteCommand="{Binding DeleteCommand}" ClearCommand="{Binding ClearCommand}" SaveCommand="{Binding SaveCommand}"
                SaveEnabled="{tsfBinding:DataOperation Path=(Validation.HasError)}" Name="FooterControl"/>

        <sdk:DataGrid x:Name="DataGridList" ItemsSource="{Binding CurrentPage}" SelectedItem="{Binding Path=CurrentItem, Mode=TwoWay}" Height="Auto" PreviewKeyDown="DataGrid_PreviewKeyDown"
                      Sorting="DataGrid_Sorting" SelectedIndex="{tsfBinding:Column Path=CurrentSelectedIndex}">
            <sdk:DataGrid.Columns>
                <sdk:DataGridTextColumn Header="Acronym" Width="*" Binding="{tsfBinding:Column Path=Acronym}"/>
                <sdk:DataGridTextColumn Header="Name" Width="*" Binding="{tsfBinding:Column Path=Name}" />
                <sdk:DataGridTextColumn Header="Valid IP Addresses" Width="2*" Binding="{tsfBinding:Column Path=ValidIPAddresses}" />
                <sdk:DataGridTextColumn Header="Enabled" Width="*" Binding="{tsfBinding:Column Path=Enabled}"/>
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>

        <uc:DataPagerUserControl CurrentPageNumber="{Binding CurrentPageNumber}" PageCount="{Binding PageCount}"
                                FirstCommand="{Binding FirstCommand}" PreviousCommand="{Binding PreviousCommand}"
                                NextCommand="{Binding NextCommand}" LastCommand="{Binding LastCommand}" VerticalAlignment="Bottom"/>
    </StackPanel>
</UserControl>
